<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Matrix207&#39;s Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Matrix207's Blog">
<meta property="og:url" content="http://yoursite.com/page/18/index.html">
<meta property="og:site_name" content="Matrix207's Blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Matrix207's Blog">
  
    <link rel="alternate" href="/atom.xml" title="Matrix207&#39;s Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Matrix207&#39;s Blog</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="Flux RSS"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Rechercher"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-batch-skill" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/12/14/batch-skill/" class="article-date">
  <time datetime="2012-12-13T16:00:00.000Z" itemprop="datePublished">2012-12-14</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/12/14/batch-skill/">Batch skill</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Batch-skills"><a href="#Batch-skills" class="headerlink" title="Batch skills"></a>Batch skills</h3><p>1.<strong>获取当前日期时间</strong><br>    set date<em>time=%date:~,10%</em>%time:~,2%<em>%time:~3,2%</em>%time:~6,2%</p>
<p>2.<strong>获取当前路径</strong><br>    set pwd=%CD%</p>
<p>3.<strong>延时</strong>  </p>
<pre><code>`ping -n 11 127.0.0.1 &gt;nul`  

ping 本机 11 次，可用于批处理延时 10 秒。命令中的&gt;nul 为屏蔽输出。  
_简短式可以写成:_  
`ping -n 11 127.1 &gt;nul`
</code></pre><p>4.<strong>计算运行时间</strong>  </p>
<pre><code>    @ECHO off&amp;setlocal enabledelayedexpansion
    CALL :TIME_START
    REM 修改这里的 ping 为你需要写的代码
    ping 127.1 -n 2 &gt;nul
    CALL :TIME_END
    PAUSE&amp;exit /B 0
    :TIME_START
    SET /a time_s=%time:~6,2%
    SET /a time_m=%time:~3,2%
    @ECHO Start  time: %time%
    GOTO :EOF
    :TIME_END
    @ECHO End  time: %time%
    SET /a diff_m=%time:~3,2%-%time_m%
    SET /a diff_s=%time:~6,2%-%time_s%
    SET /a total=&quot;%diff_m%&quot;*60+&quot;%diff_s%&quot;
    @ECHO Elapsed time: %total% sec
    GOTO :EOF

_运行效果:_  

    D:\work\project\tmp&gt;test.bat
    Start  time: 13:52:00.43
    End  time: 13:52:01.48
    Elapsed time: 1 sec
    请按任意键继续. . .
</code></pre><p>5.<strong>罗列当前目录所有 txt 文件</strong>  </p>
<pre><code>@echo off
for %%i in (*.txt) do echo &quot;%%i&quot;
pause
</code></pre><p>6.<strong>罗列当前和子目录所有 cfg 文件</strong>  </p>
<pre><code>for /r 参数 遍历搜索  
格式：`FOR /R [[drive:]path] %%variable IN (set) DO command [command-parameters]`  

举例:  
命令:(注意，该命令在 dos 窗口运行)  
    `D:\work\project\tmp\CI&gt;for /r %i in (*.cfg) do @echo %i`  

输出:  

    D:\work\project\tmp\CI\ci_cfg\ci_scm_trunk.cfg
    D:\work\project\tmp\CI\ci_cfg\ci_ubackup.cfg
    D:\work\project\tmp\CI\zd15_lcd\setup\Release\apprun.cfg
    D:\work\project\tmp\CI\zd15_lcd\setup\Release\service.cfg
    D:\work\project\tmp\CI\zd15_lcd\src\service\apprun.cfg
    D:\work\project\tmp\CI\zd15_lcd\src\service\service.cfg  

方法二:(注意，该命令在批处理文件中运行)  
    `for /f %%i in (&apos;dir /s /b /a-d *.cfg&apos;) do @ECHO %%i`  

解决路径中出现空格  
    `for /f “delims=*”%%i in (&apos;dir /s /b /a-d *.cfg&apos;) do @ECHO %%`  
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/12/14/batch-skill/" data-id="ciqqpe1en000wnmpvq92hdmcj" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/batch/">batch</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-analyze-wget-source" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/09/27/analyze-wget-source/" class="article-date">
  <time datetime="2012-09-26T16:00:00.000Z" itemprop="datePublished">2012-09-27</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/source/">source</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/09/27/analyze-wget-source/">Analyze wget source</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Log-of-study-wget-source-code"><a href="#Log-of-study-wget-source-code" class="headerlink" title="Log of study wget source code"></a>Log of study wget source code</h3><p><strong>2012-9-27 00:04:30</strong></p>
<ol>
<li>config<br> <code>./configure</code></li>
<li>compile<br> <code>make</code></li>
<li>install<br> <code>make install</code></li>
<li>uninstall<br> <code>make uninstall</code></li>
</ol>
<p>compile log: (on virtualbox os ubuntu)  </p>
<pre><code>dennis@dennis-VBox:~/project/wget/wget-1.9$ ./configure
dennis@dennis-VBox:~/project/wget/wget-1.9$ ls
dennis@dennis-VBox:~/project/wget/wget-1.9$ make
// Error message: autoconf: Command not found
// install autoconf
dennis@dennis-VBox:~/project/wget/wget-1.9$ sudo apt-get install autoconf
dennis@dennis-VBox:~/project/wget/wget-1.9$ make
// Error message: makeinfo: Command not found
// install texinfo
dennis@dennis-VBox:~/project/wget/wget-1.9$ sudo apt-get install texinfo
dennis@dennis-VBox:~/project/wget/wget-1.9$ make

Binary file &quot;wget&quot; will be generated at wget-1.9/src/
</code></pre><p><em>todo</em><br>    analyze Makefile</p>
<p><strong>2012-9-26 00:06:18</strong></p>
<ol>
<li><a href="http://www.gnu.org/software/wget/" target="_blank" rel="external">Home</a></li>
<li><a href="http://www.gnu.org/software/wget/manual/" target="_blank" rel="external">manual site</a></li>
<li>manual generation script <a href="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs.sh" target="_blank" rel="external">gendocs.sh</a></li>
<li><a href="http://www.gnu.org/software/wget/manual/wget.pdf" target="_blank" rel="external">pdf format manual</a></li>
</ol>
<p><em>todo</em><br>    compile wget source code</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/09/27/analyze-wget-source/" data-id="ciqqpe1ek000tnmpvhjpaigdv" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/wget/">wget</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-vim" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/09/26/vim/" class="article-date">
  <time datetime="2012-09-25T16:00:00.000Z" itemprop="datePublished">2012-09-26</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/09/26/vim/">VIM</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>I use a variety of vi(m) commands for my job, so many that I can’t always<br>remember how to do something that I have done before. Therefore I keep notes<br>them here, for my bad memory.</p>
<h3 id="What-is-the-difference-between-Vi-and-Vim"><a href="#What-is-the-difference-between-Vi-and-Vim" class="headerlink" title="What is the difference between Vi and Vim"></a>What is the difference between Vi and Vim</h3><p>Vim is Vi improve, everything that in vi is available in vim.<br>Here is some of the extended vim features:<a href="http://askubuntu.com/questions/418396/what-is-the-difference-between-vi-and-vim" target="_blank" rel="external">ref</a>  </p>
<ol>
<li>Vim support syntax highlighting, code folding, etc.  </li>
<li>Vim allows the screen to be split for editing multiple files.  </li>
<li>Vim includes a built in diff for comparing files (vimdiff)  </li>
<li>Vim support plugins  </li>
</ol>
<h3 id="General-command-use-in-VIM"><a href="#General-command-use-in-VIM" class="headerlink" title="General command use in VIM"></a>General command use in VIM</h3><pre><code>### insert mode
i -&gt; insert mode at cursor
I -&gt; insert mode at the beginning of Line
a -&gt; append after the cursor
A -&gt; append at the end ot line
o -&gt; insert bank line below current line
O -&gt; insert bank line above current line

### Cursor move
h,j,k,l ←, ↓, ↑, →
w      -&gt; jump to the head of next word
W      -&gt; jump to the head of next word which begin with bank
e      -&gt; jump to the end of next word
E      -&gt; jump to the end of next word which begin with bank
b      -&gt; jump to the head of previous word
B      -&gt; jump to the head of previous word which begin with bank
0      -&gt; jump to the first character of current line
$      -&gt; jump to the end of current line
^      -&gt; jump to the first not-white-space character of current line
g_     -&gt; jump to the last not-white-space character of current line
gg     -&gt; jump to the first not-while-space character of first line
G      -&gt; jump to the first not-while-space character of last line
`.     -&gt; jump the position of last edit
&apos;&apos;     -&gt; jump the previous position of cursor
H      -&gt; jump to first line of screen
M      -&gt; jump to the middle line of screen
L      -&gt; jump to the last line of screen
%      -&gt; jump to the match symbol
{      -&gt; paragraph backward
}      -&gt; paragraph backward
[      -&gt; jump to previous
]      -&gt; jump to next
zt     -&gt; move current line to the top of window
zz     -&gt; move current line to the center of window
zb     -&gt; move current line to the bottom of window
ctrl+e -&gt; scroll screen backward
ctrl+y -&gt; scrool screen forward
ctrl+u -&gt; scroll half screen backward
ctrl+d -&gt; scroll half screen backward
ctrl+f -&gt; scrool to next screen
ctrl+b -&gt; scrool to previous screen

### Edit
cw     -&gt; change word
C      -&gt; change to the end of line
u      -&gt; undo
~      -&gt; switch case
gu     -&gt; uppercase select characters
gU     -&gt; lowercase select characters
&gt;&gt;     -&gt; indent line one column right
&lt;&lt;     -&gt; indent line one column left
==     -&gt; auto-indent current line
ctrl+r -&gt; redo

### Cut, copy and paste
dd    -&gt; delete current line, and put it to clipboard
x     -&gt; delete current character
X     -&gt; delete previous character
dw    -&gt; delete to end of word
D     -&gt; delete to end of line
yy    -&gt; copy current line
yw    -&gt; copy to end of word
y$    -&gt; copy to end of line
p     -&gt; paste after the cursor
P     -&gt; paste befor the cursor
&quot;+y   -&gt; copy to system clipboard
&quot;+gP  -&gt; paste from system clipboard
[N]yy -&gt; copy N lines

### Fold
zm -&gt; increase the foldlevel by one
zM -&gt; close all open folds
zr -&gt; decrease the foldlevel by one
zR -&gt; decrease the foldlevel to zero -- all folds will be open
zo -&gt; opens a fold at the curse
zO -&gt; opens all folds at the curse
zc -&gt; close one fold
zC -&gt; close all folds at the curse
zj -&gt; jump to next fold
zk -&gt; jump to previous fold
zf -&gt; fold manual, using `V` to select lines and type `zf` to fold them

### split
:split
:vspl
ctrl+w+h/j/k/l  move cursor between split windows

### Search
*          -&gt; search string forward
#          -&gt; search string backward
/pattern   -&gt; search for pattern
/\cpattern -&gt; search for pattern, ignore upper and lower case
/pattern\c -&gt; search for pattern, ignore upper and lower case
?pattern   -&gt; search backwards for pattern
n          -&gt; repeat search in same direction
N          -&gt; repeat search in opposite direction
f          -&gt; search character forward
F          -&gt; search character backward

### Save and quit
:w  -&gt; save
:wq -&gt; save and quit
:x  -&gt; save and quit
:q  -&gt; quit, fail to quit if not save the changed
:q! -&gt; force quit
ZZ  -&gt; save and quit

### File 
use `vim file1 file2 ...` to open multiple files
:bn     -&gt; next buffer
:bp     -&gt; previous buffer 
:bd!    -&gt; delete current buffer tag  
:e path -&gt; edit file
:e      -&gt; reload current file
:r !cmd -&gt; read the result the command to the cursor of current file

### simple skills
xp   -&gt; swap two characters
gg=G -&gt; indent the file
[N]G -&gt; jump to Nth line
yyp  -&gt; copy and paste current line
yw   -&gt; yank to the end of word
yiw  -&gt; yank word
=    -&gt; auto-indent selected lines
==   -&gt; auto-indent current lines
n==  -&gt; auto-indent [count] lines (start from current line)
gd   -&gt; jump to the defined position of variable

### Other
.             -&gt; repeat last change
J             -&gt; join [count] lines
:nohl         -&gt; not highlight
:set          -&gt; nu show number
:set          -&gt; wrap
:set          -&gt; nowrap
:set          -&gt; syntax=python` manual set syntax language
C-x or C-a    -&gt; minus or add 1 to current digit
:%!xxd        -&gt; hex edit
:%!xxd -r     -&gt; return from hex edit
:set mouse =  -&gt; available right button of mouse
:set mouse =a -&gt; disable right button of mouse
:set paste    -&gt; useful for paste text to vim
:set nopaste  -&gt; disable paste mode

### substitute
(use command &quot;:help substitue&quot; for more information)
:[range]s/pattern/string/[c,e,g,i]
  range   1,7 line 1 to 7  1,$ line 1 to last  % all lines
  pattern string  be searched
  string  string for substitute
  c    comfirm
  e    not show error
  g    global, match all search of current line
  i    ignore
e.g.
  :%s/\s\+$//        delete all spaces between first space to the end of line
  :%s/h14/h12/g   replace h14 to be h12 for all occurrence in the file
  :1,$s/h14/h12/g replace h14 to be h12 from first line to the last line

### Visual Mode
(use command &quot;:help v&quot; for more information)
v      start visual mode per character
V      start visual mode linewise
ctrl+v start visual mode blockwise

### Text object (multiple lines possible)
(use command &quot;:help objects&quot; for more information)
Operator Mapping
v|c|d|y     i|a          {|[|(|&quot;|&apos;|w|p
visual  Inner Object      Region
change     An Object      {} [] () &quot;&quot; &apos;&apos; word paragraph
delete
yank
e.g.
  vi{ : select characters between brace
  va&quot; : select characters, include double quotes
  viw : visual a word
  di&quot; : delete characters between quotes
  ci( : change characters between bracket

### do operation to string (single line only)
v|c|d|y  f|t  character, work on current line only
e.g:
  vf{ : select characters to the first &apos;{&apos;, include &apos;{&apos;.
  vt{ : select characters to the first &apos;{&apos;, exclude &apos;{&apos;.
  using `;` to select the next character
v|c|d|y  /|?  character, work on the whole paper
e.g:
  v/{&lt;CR&gt; : select characters to the first &apos;{&apos;, include &apos;{&apos;.
  v///&lt;CR&gt; : select characters to the first &apos;//&apos;, include &apos;//&apos;.
  v?{ : select characters to the first &apos;{&apos;, exclude &apos;{&apos;.
  using `n` or `N` to select the next character

### do operation on lines
[N]yy : copy N lines
[N]dd : delete N lines
:.,+2d : delete current line through the next 2 lines
:3,5m10 : move lines 3 through 5 to follow 10 (like delete and put in vi)
:3,5co10 : copy lines 3 through 5 to after 10 (like yank and put in vi)
:3,5t. : copy lines 3 through 5 to current line (like yank and put in vi)

### Auto completion
C-p
C-n
C-x C-p Word completion, backward
C 10 -x C-n Word completion, forward
C-x C-l Line completion
C-x C-f File name completion

### regular expression
:help regexp  -&gt; for more information
. any character without new line
* 0 or more
^ begin of the line
$ end of the line
\+ 1 or more
\? 0 or 1
\
|
[] -&gt; [abc], [^abc], [a-z]
()
{} -&gt; {n}, {n,}, {n,m}
\d -&gt; digit, [0-9]
\D -&gt; non-digit, [^0-9]
\s -&gt; whitespace character: &lt;Space&gt; and &lt;Tab&gt;
\S -&gt; non-whitespace character
\w
\x    hex digit:            [0-9A-Fa-f]
\X    non-hex digit:            [^0-9A-Fa-f]
\o    octal digit:            [0-7]
\O    non-octal digit:        [^0-7]
\w    word character:            [0-9A-Za-z_]
\W    non-word character:        [^0-9A-Za-z_]
\h    head of word character:        [A-Za-z_]
\H    non-head of word character:    [^A-Za-z_]
\a    alphabetic character:        [A-Za-z]
\A    non-alphabetic character:    [^A-Za-z]
\l    lowercase character:        [a-z]
\L    non-lowercase character:    [^a-z]
\u    uppercase character:        [A-Z]
\U    non-uppercase character:    [^A-Z]

### Session
:mksession .mysession.vim make a session for current documents, use &quot;gvim -S 
.mysession.vim&quot; to open it.

### History
q: enter history commands, then choose and execute the command

### Marks
(use command &quot;:help mark-motions&quot; for more information)
mx     set mark x, x can use a..z characters
&apos;x     jump to mark x
:marks show all marks

### Register
:reg  view register content
&quot;0p   paste from register 0
&quot;1p   paste from register 1
&quot;_D   delete contents to back hole register

### Complex repeats
qq operators q   record all operators to q register
100@q            repeat the operators 100 times

### Editing Files in other places
vim scp://[user@]hostname[:port]//FilePath
e.g.: vim scp://root@172.16.110.39//root/a.c

### Merge code by vimdiff
`]c` go to next difference
`[c` go to previous difference
`do` diff get, get the change from another file to current file
`dp` diff put, put the change from current file to another file

### source vimrc, not need to exit vim to make config effective
:so %        -&gt; source current file(.vimrc)
:so ~/.vimrc -&gt; source specified file

### run vi scripts under terminal
vi -e -s -c &quot;:%s/pattern/string/g&quot; -c &quot;:wq&quot; file-name

### Help
:help symbol
</code></pre><h3 id="skills-for-program"><a href="#skills-for-program" class="headerlink" title="skills for program"></a>skills for program</h3><ol>
<li>open file on current cursor, use command <code>gf</code>; if the file is not in current<br> directory, use <code>:set path+=yourfilepath</code> to add more dir to the path, use<br> <code>:help path</code> for more info.</li>
</ol>
<h3 id="some-skills"><a href="#some-skills" class="headerlink" title="some skills"></a>some skills</h3><ol>
<li><p>command mode type <code>:nohl</code> cancel high light</p>
</li>
<li><p>substituttion<br>sample lines:  </p>
<blockquote>
<p>+ (<a href="http://www.google.com)\[google\" target="_blank" rel="external">http://www.google.com)\[google\</a>]<br>+ (<a href="http://www.wolframalpha.com/)\[wolfram\" target="_blank" rel="external">http://www.wolframalpha.com/)\[wolfram\</a>]<br>into the lines:<br>+ [google](<a href="http://www.google.com" target="_blank" rel="external">http://www.google.com</a>)<br>+ [wolfram](<a href="http://www.wolframalpha.com/" target="_blank" rel="external">http://www.wolframalpha.com/</a>)<br>Here is the command to do this:<br><code>:%s/+ \(.*\)\(\[.*\]\)/+ \2\1/g</code>  </p>
</blockquote>
</li>
<li><p>compare file<br><code>vimdiff file1 file2</code> or <code>gvim -d file1 file2</code></p>
</li>
<li><p>digit operator<br> <code>ctrl+a</code> increment 1<br> <code>ctrl+x</code> subtract 1  </p>
</li>
<li><p>delete all comments<br> <code>:%s/\/\*\_.\{-}\*\//g</code> or <code>:%s#\M/*\m\_.\{-}\M*/##g</code></p>
</li>
<li><p>delete match/unmatch lines<br> <code>:g/.*patternSearch.*/d</code><br> <code>:v/#include/d</code> Delete all lines except “#include” lines  </p>
</li>
<li><p>more substitution<br> Substituting all lines with its line number<br> <code>:%s/^/\=line(&quot;.&quot;) . &quot;. &quot;/g</code><br> Resort numeric<br> <code>:4,$s/\d\+/\=submatch(0) + 1/</code><br> Insert sequence number to column position<br> <code>:%s/table\[\]/\=&#39;table[&#39; . printf(&quot;%d&quot;,line(&quot;.&quot;)) . &#39;]&#39;/g</code><br> <code>:%s/table\[\]/\=&#39;table[&#39; . printf(&quot;%d&quot;,line(&quot;.&quot;)+9) . &#39;]&#39;/g</code> start from 10  </p>
</li>
<li><p>delete bank line<br> <code>:g/^$/d</code><br> <code>:g/^ *$/d</code> delete lines only contain space   </p>
</li>
<li><p>add “inline” to all function<br> <code>:%s/\(.*(\)/inline \1/g</code>  this can work, but not perfect!!<br> <code>%s/\(^[□tab]*\)\(.*(.*\)/\1inline \2/g</code>  </p>
</li>
<li><p>delete all spaces at the end of every line:<br><code>:%s/\(.*\)  *$/\1/</code></p>
</li>
<li><p>read range of lines from another file to current file<br><code>:r! sed -n 100,158p /home/dennis/test.c</code></p>
</li>
<li><p>list all the match lines of searching on screen<br><code>:g/pattern/p</code> In its longer format: <code>:global/regular-expression/print</code><br>If <code>pattern</code> is leave out, like <code>:g//p</code>, vim will uses previous search item.<br>You can leave <code>p</code> out too, because p(rint) is the default action.</p>
</li>
<li><p>copy all lines containing a search pattern<br><code>qaq</code> clear register a<br><code>:g/pattern/y A</code> append all matching lines to register, then use <code>p</code> to paster them.</p>
</li>
<li><p>make a list number, reference <a href="http://vim.wikia.com/wiki/Making_a_list_of_numbers" target="_blank" rel="external">this</a></p>
<p>first, add this code to vimrc:  </p>
<pre><code>&quot; Add argument (can be negative, default 1) to global variable i.
&quot; Return value of i before the change.
function Inc(...)
  let result = g:i
  let g:i += a:0 &gt; 0 ? a:1 : 1
  return result
endfunction
</code></pre><p>then type <code>:so ~/.vimrc</code> to make it effective, and use command<br><code>:let i = 1 | %s/ /\=&#39; &#39; . Inc() . &#39;.&#39;/</code></p>
<p>before:  </p>
<pre><code>* How do you write a fast network server?
* How do you write a network server that can handle 10000 clients?
* What bottlenecks are there and how do you avoid them?
</code></pre><p>after:  </p>
<pre><code>* 10.How do you write a fast network server?
* 11.How do you write a network server that can handle 10000 clients?
* 12.What bottlenecks are there and how do you avoid them?
</code></pre><p>Test command <code>:let i = 0 | %s/f0/\=&#39;f&#39; . Inc()/</code></p>
<p>before:</p>
<pre><code>&lt;f0&gt;int state;\l|\
&lt;f0&gt;int iostate;\l|\
&lt;f0&gt;int fd;\l|\
&lt;f0&gt;struct session *session;\l|\
</code></pre><p>after:</p>
<pre><code>&lt;f0&gt;int state;\l|\
&lt;f1&gt;int iostate;\l|\
&lt;f2&gt;int fd;\l|\
&lt;f3&gt;struct session *session;\l|\
</code></pre></li>
<li><p>delete all space character at the end of each line<br><code>:%s/\s\+$//g</code><br>and for the beginning of each line is <code>:%s/^\s\+//g</code></p>
</li>
<li><p><code>g?</code> translate the selected content by <a href="https://en.wikipedia.org/wiki/ROT13" target="_blank" rel="external">ROT13</a>, using <code>u</code> to cancel operation</p>
</li>
<li><p><code>:%TOhtml</code> translate to html format</p>
</li>
<li><p>Encrypt<br>method one <code>:set key=123456</code>, then save and quit <code>:wq</code><br>method two <code>:X</code>, type the passwd twice，save and quit <code>:wq</code><br>clean passwd <code>:set key=</code>, save and quit <code>:wq</code></p>
</li>
<li><p><code>autocmd FileType c,cpp set shiftwidth=4 | set expandtab</code> add to .vimrc, expand tab to be four space</p>
</li>
<li><p><code>23,38w newfile</code> write the content between specify lines to file, <code>320,$ &gt;&gt;newfile</code> append to file</p>
</li>
<li><p><code>23,38!sort</code> sort lines 23 through 38</p>
</li>
<li><p><code>%s/  */\r/g</code> replace space as return<br><code>%s/[ \t][ \t]*/\r/g</code> replace space or tab as return</p>
</li>
<li><p><code>%s/\(\S\) \+/\1/g</code> delete all whitespace characters which after non-whitespace.</p>
</li>
<li><p><code>:g/\[/,/\]/j</code> join multiple line to one</p>
</li>
</ol>
<h3 id="other-valued-skills"><a href="#other-valued-skills" class="headerlink" title="other valued skills"></a>other valued skills</h3><ul>
<li><a href="http://www.brezeale.com/technical_notes/vim_notes.shtml" target="_blank" rel="external">vim notes</a></li>
<li><a href="http://vim.wikia.com/wiki/Category:VimTip" target="_blank" rel="external">VimTip - Vim Tips Wiki</a></li>
<li><a href="http://vim.wikia.com/wiki/Best_Vim_Tips" target="_blank" rel="external">Best Vim Tips</a></li>
<li><a href="http://www.rayninfo.co.uk/vimtips.html" target="_blank" rel="external">Best of Vim Tips</a></li>
<li><a href="http://www.thegeekstuff.com/2009/04/vi-vim-editor-search-and-replace-examples/" target="_blank" rel="external">12 Powerful Find and Replace Examples</a></li>
</ul>
<h3 id="other-version"><a href="#other-version" class="headerlink" title="other version"></a>other version</h3><ul>
<li><a href="https://neovim.io/" target="_blank" rel="external">neovim</a></li>
</ul>
<h3 id="Vundle-plugin-manager"><a href="#Vundle-plugin-manager" class="headerlink" title="Vundle, plugin manager"></a>Vundle, plugin manager</h3><ul>
<li><a href="http://beiyuu.com/git-vim-tutorial/" target="_blank" rel="external">Git时代的VIM不完全使用教程</a></li>
<li>install<ul>
<li><code>git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle</code></li>
</ul>
</li>
<li><p>.vimrc(put plugin name behind <code>Bundle</code>, more plugin see <a href="http://vim-scripts.org/vim/scripts.html" target="_blank" rel="external">vim-scripts.org</a>)</p>
<pre><code>set nocompatible &quot; be iMproved
filetype off &quot; required!

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

&quot; let Vundle manage Vundle
&quot; required!
Bundle &apos;gmarik/vundle&apos;

&quot; vim-scripts repos
Bundle &apos;vim-plugin-foo&apos;
Bundle &apos;vim-plugin-bar&apos;

filetype plugin indent on &quot; required!
</code></pre></li>
<li><p>manage plugin</p>
<ul>
<li><code>:BundleInstall</code></li>
<li><code>:BundleUpdate</code></li>
<li><code>:BundleClean</code></li>
</ul>
</li>
<li>powerful plugin<ul>
<li>Bundle ‘ag.vim’</li>
<li>Bundle ‘ctrlp.vim’</li>
<li>Bundle ‘EasyMotion’</li>
<li>Bundle ‘The-NERD-tree’</li>
<li>Bundle ‘The-NERD-Commenter’</li>
<li>Bundle ‘UltiSnips’</li>
<li>Bundle ‘Tabular’</li>
<li>Bundle ‘Valloric/YouCompleteMe’</li>
</ul>
</li>
</ul>
<h3 id="install-vim-by-source"><a href="#install-vim-by-source" class="headerlink" title="install vim by source"></a>install vim by source</h3><ul>
<li>./configure –prefix=path-to-install</li>
<li>make &amp;&amp; make install</li>
<li>export PATH=path-to-install:PATH</li>
</ul>
<h3 id="some-useful-configuration-of-vimrc"><a href="#some-useful-configuration-of-vimrc" class="headerlink" title="some useful configuration of vimrc"></a>some useful configuration of vimrc</h3><ul>
<li><code>set nu</code> show line number</li>
<li><code>set hls</code> highlight search</li>
<li><a href="http://vim.wikia.com/wiki/Toggle_auto-indenting_for_code_paste" target="_blank" rel="external">Toggle auto indenting for code paste</a> <ul>
<li><code>:set paste</code></li>
<li><code>:set nopaste</code></li>
</ul>
</li>
</ul>
<h3 id="reference"><a href="#reference" class="headerlink" title="reference"></a>reference</h3><ul>
<li><a href="http://www.moolenaar.net/" target="_blank" rel="external">vim author</a></li>
<li><a href="http://wiki.hotoo.me/Vim.html" target="_blank" rel="external">vim fans</a></li>
<li><a href="http://coolshell.cn/articles/5426.html" target="_blank" rel="external">简明 Vim 练级攻略</a></li>
<li><a href="http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/" target="_blank" rel="external">Learn Vim Progressively</a></li>
<li><a href="http://vim.wikia.com/wiki/Power_of_g" target="_blank" rel="external">Power of g</a></li>
<li><a href="http://michael.peopleofhonoronly.com/vim/" target="_blank" rel="external">vim cheat sheet for programmers</a></li>
<li><a href="http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html" target="_blank" rel="external">Linux vi and vim editor: Tutorial and advanced features</a></li>
<li><a href="http://vimregex.com/" target="_blank" rel="external">vim regular expressions</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/09/26/vim/" data-id="ciqqpe1eg000qnmpv927mcf2n" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vim/">vim</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-study-plan-120924" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/09/24/study-plan-120924/" class="article-date">
  <time datetime="2012-09-23T16:00:00.000Z" itemprop="datePublished">2012-09-24</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/person/">person</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/09/24/study-plan-120924/">Study plan in the future</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>Study plan in the future</p>
<p><a href="http://www.net-snmp.org/" target="_blank" rel="external">net-snmp</a></p>
<p><a href="http://directory.fsf.org/wiki/GNU" target="_blank" rel="external">GNU Software list</a> <a href="http://zh.wikipedia.org/wiki/%E5%BC%80%E6%94%BE%E6%BA%90%E4%BB%A3%E7%A0%81%E8%BD%AF%E4%BB%B6%E5%88%97%E8%A1%A8#.E6.96.87.E6.9C.AC.E7.BC.96.E8.BE.91.E5.99.A8" target="_blank" rel="external">zh linker</a></p>
<p><a href="http://www.gnu.org/software/wget/" target="_blank" rel="external">wget</a></p>
<p><a href="http://en.wikipedia.org/wiki/Standard_Commands_for_Programmable_Instruments" target="_blank" rel="external">SCPI protocol</a></p>
<p><a href="http://linux.101hacks.com/toc/" target="_blank" rel="external">Linux 101 hacks</a></p>
<p><a href="http://www.thegeekstuff.com/archives-2/" target="_blank" rel="external">Read this blog articles</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/09/24/study-plan-120924/" data-id="ciqqpe1ed000nnmpvsjenz40c" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/study/">study</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-vimrc" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/09/22/vimrc/" class="article-date">
  <time datetime="2012-09-21T16:00:00.000Z" itemprop="datePublished">2012-09-22</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/09/22/vimrc/">Vim configuration</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Vim配置文件vimrc"><a href="#Vim配置文件vimrc" class="headerlink" title="Vim配置文件vimrc:"></a>Vim配置文件vimrc:</h3><pre><code>&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot; Description: .vimrc
&quot; History:
&quot;         2013/07/31 Dennis  forbid clang auto-compile, restore ctag, and update cscope
&quot;         2013/07/05 Dennis  use clang-complete instead Omni plugin
&quot;         2013/04/16 Dennis  Add plugin AutoComplPop.vim and snipMate.vim
&quot;         2012/12/29 Dennis  Create
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot; 影响全部用户的配置:
&quot; 插件 *.vim 拷贝到 /usr/share/vim/vim73/plugin/
&quot; 文档 *.txt 拷贝到 /usr/share/vim/vim73/doc/
&quot; 影响当前用户的配置:
&quot; 插件 *.vim 拷贝到 ~/.vim/plugin/
&quot; 文档 *.txt 拷贝到 ~/.vim/doc/
&quot;
&quot; 中文在线帮助
&quot; http://man.chinaunix.net/newsoft/vi/doc/help.html
&quot;
&quot; 更多参考
&quot; http://blog.csdn.net/wooin/article/details/1858917
&quot; https://github.com/easwy/share/blob/master/vim/vimrc/_vimrc
&quot;
&quot; vimrc 语法相关
&quot; help key-notation
&quot; &lt;CR&gt;  回车
&quot; &lt;up&gt; &lt;left&gt; &lt;right&gt; &lt;down&gt; 方向键
&quot; &lt;Esc&gt;
&quot; &lt;C-x&gt; 表示 Ctrl+x
&quot; &lt;S-x&gt; 表示 Shift+x
&quot; &lt;Tab&gt;
&quot; &lt;M-x&gt; Alt+x
&quot; &lt;A-x&gt; Alt+x
&quot; iab 插入模式的缩写
&quot; imap 插入模式的键映射
&quot;

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;常规设置

&quot;编码设置
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936

&quot; 字体
if has(&quot;gui_running&quot;)
  if has(&quot;gui_gtk2&quot;)
    &quot;set guifont=Inconsolata\ 12
    set guifont=Liberation\Mono\ 12
  elseif has(&quot;gui_win32&quot;)
    set guifont=Consolas:h11:cANSI
  endif
endif

&quot;语言设置
set helplang=cn
set encoding=utf8 
set langmenu=zh_CN.UTF-8 
set imcmdline 
source $VIMRUNTIME/delmenu.vim 
source $VIMRUNTIME/menu.vim

&quot;语法高亮
syntax enable
syntax on
colorscheme desert

set number

set autochdir

set tags=tags

set hlsearch

set tabstop=4 softtabstop=4 shiftwidth=4 expandtab

set nowrap
set nobackup

&quot; default &lt;Leader&gt; map backslash
:let mapleader = &quot;,&quot;

&quot;分割为两行
:nnoremap K i&lt;CR&gt;&lt;Esc&gt;

:set colorcolumn=81

&quot;全选
&quot;map &lt;C-a&gt; ggVG

&quot;自动对齐
set autoindent 

&quot; 开始折叠
set foldenable
&quot; 设置语法折叠
&quot; manual  手工定义折叠
&quot; indent  更多的缩进表示更高级别的折叠
&quot; expr    用表达式来定义折叠
&quot; syntax  用语法高亮来定义折叠
&quot; diff    对没有更改的文本进行折叠
&quot; marker  对文中的标志折叠
set foldmethod=indent
&quot;折叠相关的快捷键
&quot;zR 打开所有的折叠
&quot;za Open/Close (toggle) a folded group of lines.
&quot;zA Open a Closed fold or close and open fold recursively.
&quot;zi 全部 展开/关闭 折叠
&quot;zo 打开 (open) 在光标下的折叠
&quot;zc 关闭 (close) 在光标下的折叠
&quot;zC 循环关闭 (Close) 在光标下的所有折叠
&quot;zM 关闭所有可折叠区域
&quot; 设置折叠区域的宽度
set foldcolumn=0
&quot; 设置折叠层数为
setlocal foldlevel=1
&quot; 新建的文件，刚打开的文件不折叠
autocmd! BufNewFile,BufRead * setlocal nofoldenable


&quot; splite
&quot; 横向划分
nmap &lt;Leader&gt;h :spl&lt;CR&gt;
&quot; 竖向划分
nmap &lt;Leader&gt;v :vspl&lt;CR&gt;
&quot; 加宽
nmap + &lt;C-W&gt;+
&quot; 减宽
nmap - &lt;C-W&gt;-

map &lt;leader&gt;y &quot;+y
map &lt;leader&gt;p &quot;+gP

&quot; 刷新文件
&quot; :e


&quot; 设置代码自动补全快捷键(这些方法在插件中已经实现)
&quot;设置文件头
:iab ihead &lt;Esc&gt;ggO/*&lt;CR&gt;Copyleft(c) 2014-2015 &lt;CR&gt;Authored by Dennis on:&lt;Esc&gt;:
    \ read !date &lt;CR&gt;kJ$a&lt;CR&gt;@desc:&lt;CR&gt;@history&lt;CR&gt;*/&lt;Esc&gt;

&quot;插入日期和时间
&quot;:iab idate A&lt;C-R&gt;=strftime(&quot;%c&quot;)&lt;CR&gt;&lt;Esc&gt;
:iab idate &lt;Esc&gt;:read !date &quot;+\%Y-\%m-\%d \%T&quot; &lt;Esc&gt;

&quot;c框架frame
:iab ifc  #include &lt;stdio.h&gt;&lt;CR&gt;&lt;CR&gt;int main(int argc, char* argv[])&lt;CR&gt;{&lt;CR&gt;
    \ &lt;Tab&gt;return 0;&lt;CR&gt;}&lt;Esc&gt;2&lt;up&gt;
&quot;c++框架frame
:iab ifcpp #include &lt;iostream&gt;&lt;CR&gt;using namespace std;&lt;CR&gt;&lt;CR&gt;int main(int argc,
    \ char* argv[])&lt;CR&gt;{&lt;CR&gt;&lt;Tab&gt;return 0;&lt;CR&gt;}&lt;Esc&gt;2&lt;up&gt;

:iab iif if ()&lt;CR&gt;{&lt;CR&gt;}&lt;Esc&gt;2&lt;UP&gt;f)i
:iab FF for(int i=0; i&lt;; i++)&lt;CR&gt;{&lt;CR&gt;}&lt;Esc&gt;2&lt;UP&gt;f&lt;a
:iab iswitch switch()&lt;CR&gt;{&lt;CR&gt;&lt;Tab&gt;case :&lt;CR&gt;&lt;Tab&gt;break;&lt;CR&gt;&lt;Tab&gt;default :&lt;CR&gt;
    \ &lt;Tab&gt;break;&lt;CR&gt;}&lt;Esc&gt;7&lt;UP&gt;f)i

filetype plugin on

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;Ctags 定位变量、宏和函数的定义
&quot;yum install ctags
&quot;ctags -R
&quot;:set tags=/home/***/tags
&quot;&lt;C-]&gt; 定位到定义处 &lt;C-T&gt;返回
&quot; configure tags - add additional tags here or comment out not-used ones
set tags+=~/.vim/tags/system

&quot; build tags with Ctrl-F12
&quot;--c++-kinds=+p  : 为C++文件增加函数原型的标签
&quot;--fields=+iaS   : 在标签文件中加入继承信息(i)、
&quot;                  类成员的访问控制信息(a)、以及函数的指纹(S)
&quot;--extra=+q      : 为标签增加类修饰符。注意，如果没有此选项，将不能对类成员补全
map &lt;C-F12&gt; :!ctags -R -I --c++-kinds=+p --fields=+iaS --extra=+q .&lt;CR&gt;

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;clang-complete
&quot;c/c++自动补全插件
&quot;let g:clang_complete_copen=1
&quot;let g:clang_periodic_quickfix=1
&quot;let g:clang_snippets=1
&quot;let g:clang_close_preview=1
&quot;let g:clang_use_library=1
&quot;let g:clang_user_options=&apos;-stdlib=libstdc++ -std=c++11 -I/usr/include&apos;

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;echofunc.vim 
let g:EchoFuncShowOnStatus = 1

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;TagList 高效浏览源码
&quot;http://www.vim.org/scripts/script.php?script_id=273
&quot;:Tlist 打开

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;WinManager
&quot;http://www.vim.org/scripts/script.php?script_id=95
&quot;wm 关闭/打开netrw和TagList窗口
&quot;:help winmanager
let g:winManagerWindowLayout=&apos;FileExplorer|TagList&apos;
nmap wm :WMToggle&lt;cr&gt;
&quot;刷新目录信息 :e .

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot; cscope
&quot; yum install cscope
&quot; cscope -Rb
&quot; :cscope add ../cscope.out
&quot; (type &quot;:help :cscope&quot; in vim to show help)
&quot; from http://vim.wikia.com/wiki/Autoloading_Cscope_Database 
function! LoadCscope()
  let db = findfile(&quot;cscope.out&quot;, &quot;.;&quot;)
  if (!empty(db))
    let path = strpart(db, 0, match(db, &quot;/cscope.out$&quot;))
    set nocscopeverbose &quot; suppress &apos;duplicate connection&apos; error
    exe &quot;cs add &quot; . db . &quot; &quot; . path
    set cscopeverbose
  endif
endfunction
au BufEnter /* call LoadCscope()

&quot; s symbol
&quot; g definition
&quot; d called
&quot; c calling
&quot; t text
&quot; e grep
&quot; f file
&quot; i #include this file
nmap &lt;C-@&gt;s :cs find s &lt;C-R&gt;=expand(&quot;&lt;cword&gt;&quot;)&lt;CR&gt;&lt;CR&gt;
nmap &lt;C-@&gt;g :cs find g &lt;C-R&gt;=expand(&quot;&lt;cword&gt;&quot;)&lt;CR&gt;&lt;CR&gt;
nmap &lt;C-@&gt;c :cs find c &lt;C-R&gt;=expand(&quot;&lt;cword&gt;&quot;)&lt;CR&gt;&lt;CR&gt;
nmap &lt;C-@&gt;t :cs find t &lt;C-R&gt;=expand(&quot;&lt;cword&gt;&quot;)&lt;CR&gt;&lt;CR&gt;
nmap &lt;C-@&gt;e :cs find e &lt;C-R&gt;=expand(&quot;&lt;cword&gt;&quot;)&lt;CR&gt;&lt;CR&gt;
nmap &lt;C-@&gt;f :cs find f &lt;C-R&gt;=expand(&quot;&lt;cfile&gt;&quot;)&lt;CR&gt;&lt;CR&gt;
nmap &lt;C-@&gt;i :cs find i ^&lt;C-R&gt;=expand(&quot;&lt;cfile&gt;&quot;)&lt;CR&gt;$&lt;CR&gt;
nmap &lt;C-@&gt;d :cs find d &lt;C-R&gt;=expand(&quot;&lt;cword&gt;&quot;)&lt;CR&gt;&lt;CR&gt;

:set cscopequickfix=s-,c-,d-,i-,t-,e-

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot; QuickFix (已是标准,不用单独安装)
&quot; :help quickfix
&quot; :cw 打开 quickfix窗口
nmap &lt;F6&gt; :cn&lt;CR&gt;
nmap &lt;F7&gt; :cp&lt;CR&gt;

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;MiniBufExplorer 快速浏览和操作Buffer
&quot;http://www.vim.org/scripts/script.php?script_id=159
&quot;&lt;C-Tab&gt; 向前循环切换到每个buffer上,并在当前窗口打开
&quot;&lt;C-S-Tab&gt; 向后循环切换到每个buffer上,并在当前窗口打开
let g:miniBufExplMapCTabSwitchBufs = 1
&quot;用&lt;C-h,j,k,l&gt;切换到上下左右的窗口
let g:miniBufExplMapWindowNavVim = 1
&quot;用&lt;C-箭头键&gt;切换到上下左右窗口中去
&quot;let g:miniBufExplMapWindowNavArrows = 1
&quot;设定自动开启MiniBufExplorer的文件数目
let g:miniBufExplorerMoreThanOne=2
nmap &lt;C-N&gt; :bn&lt;CR&gt;
nmap &lt;C-P&gt; :bp&lt;CR&gt;
map &lt;leader&gt;b :MiniBufExplorer&lt;cr&gt;
map &lt;leader&gt;c :CMiniBufExplorer&lt;cr&gt;
map &lt;leader&gt;u :UMiniBufExplorer&lt;cr&gt;

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;c/h文件间相互切换 -- 插件: A
&quot;http://www.vim.org/scripts/script.php?script_id=31
&quot;:A :AS横向窗口 :AV纵向窗口 :AT新建标签
nnoremap &lt;silent&gt; &lt;F12&gt; :A&lt;CR&gt;

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;Grep 在工程中查找
&quot;http://www.vim.org/scripts/script.php?script_id=311
&quot;nnoremap &lt;silent&gt; &lt;F3&gt; :Grep&lt;CR&gt;

nnoremap &lt;silent&gt; &lt;F3&gt; :vimgrep &lt;cword&gt;  *.h *.c &lt;CR&gt;

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;close error window
nnoremap &lt;silent&gt; &lt;F4&gt; :cclose &lt;CR&gt;

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;自动补全
&quot;:help complete
&quot;Ctrl+P 向前切换成员
&quot;Ctrl+N 向后切换成员
&quot;Ctrl+E 表示退出下拉窗口, 并退回到原来录入的文字
&quot;Ctrl+Y 表示退出下拉窗口, 并接受当前选项
&quot;Ctrl+X Ctrl+L 整行补全
&quot;Ctrl+X Ctrl+N 根据当前文件里关键字补全
&quot;Ctrl+X Ctrl+K 根据字典补全
&quot;Ctrl+X Ctrl+T 根据同义词字典补全
&quot;Ctrl+X Ctrl+I 根据头文件内关键字补全
&quot;Ctrl+X Ctrl+] 根据标签补全
&quot;Ctrl+X Ctrl+F 补全文件名
&quot;Ctrl+X Ctrl+D 补全宏定义
&quot;Ctrl+X Ctrl+V 补全vim命令
&quot;Ctrl+X Ctrl+U 用户自定义补全方式
&quot;Ctrl+X Ctrl+S 拼写建议

&quot; 字典
&quot; http://www.vim.org/scripts/script.php?script_id=195
&quot; tar xvf ~/Downloads/engspchk.tar.gz CVIMSYN/engspchk.dict

setlocal dictionary+=$VIMRUNTIME/dict/english.dict

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;代码自动提示 AutoComplPop 
&quot;http://www.vim.org/scripts/script.php?script_id=1879
&quot;代码模板补全 snipMate 
&quot;http://www.vim.org/scripts/script.php?script_id=2540

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;注释代码
&quot;注释 vimrc, 符号&quot;
&quot;nmap &lt;C-M&gt;v :s/^\(&quot;\)*/&quot;/g&lt;CR&gt;:nohl&lt;CR&gt;
nmap &lt;C-M&gt;v :s/^/&quot;/g&lt;CR&gt;:nohl&lt;CR&gt;
nmap &lt;S-M&gt;v :s/^\(&quot;\)//g&lt;CR&gt;:nohl&lt;CR&gt;
&quot;vmap &lt;C-M&gt;v :s/^\(&quot;\)*/&quot;/g&lt;CR&gt;:nohl&lt;CR&gt;
vmap &lt;C-M&gt;v :s/^/&quot;/g&lt;CR&gt;:nohl&lt;CR&gt;
vmap &lt;S-M&gt;v :s/^\(&quot;\)//g&lt;CR&gt;:nohl&lt;CR&gt;
&quot;注释 c/c++, 符号//
nmap &lt;C-M&gt;c :s#^\(//\)*#//#g&lt;CR&gt;:nohl&lt;CR&gt;
nmap &lt;S-M&gt;c :s#^\(//\)##g&lt;CR&gt;:nohl&lt;CR&gt;
vmap &lt;C-M&gt;c :s#^\(//\)*#//#g&lt;CR&gt;:nohl&lt;CR&gt;
vmap &lt;S-M&gt;c :s#^\(//\)##g&lt;CR&gt;:nohl&lt;CR&gt;
&quot;注释 shelc, 符号#
nmap &lt;C-M&gt;s :s@^\(#\)*@#@g&lt;CR&gt;:nohl&lt;CR&gt;
nmap &lt;S-M&gt;s :s@^\(#\)@@g&lt;CR&gt;:nohl&lt;CR&gt;
vmap &lt;C-M&gt;s :s@^\(#\)*@#@g&lt;CR&gt;:nohl&lt;CR&gt;
vmap &lt;S-M&gt;s :s@^\(#\)@@g&lt;CR&gt;:nohl&lt;CR&gt;
&quot;注释 batch, 符号::
nmap &lt;C-M&gt;b :s/^\(::\)*/::/g&lt;CR&gt;:nohl&lt;CR&gt;
nmap &lt;S-M&gt;b :s/^\(::\)//g&lt;CR&gt;:nohl&lt;CR&gt;
vmap &lt;C-M&gt;b :s/^\(::\)*/::/g&lt;CR&gt;:nohl&lt;CR&gt;
vmap &lt;S-M&gt;b :s/^\(::\)//g&lt;CR&gt;:nohl&lt;CR&gt;

&quot; Blue:
&quot;      classes structures typedefs interfaces namespaces
&quot; Gray:
&quot;       variables
&quot; Purple:
&quot;      preprocessor macros
&quot; Red:
&quot;       methods
&quot; White:
&quot;      comment
&quot; Green:
&quot;      
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/09/22/vimrc/" data-id="ciqqpe1e9000knmpvhtniifgm" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vim/">vim</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-MSVS-auto-compile" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/09/19/MSVS-auto-compile/" class="article-date">
  <time datetime="2012-09-18T16:00:00.000Z" itemprop="datePublished">2012-09-19</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/09/19/MSVS-auto-compile/">MS Visual Studio auto compile</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="文件列表"><a href="#文件列表" class="headerlink" title="文件列表"></a>文件列表</h3><ul>
<li>主程序 <code>main.bat</code></li>
<li>配置文件 <code>project.cfg</code></li>
<li>编译器环境设置 <code>vsvars.bat</code></li>
</ul>
<h3 id="操作步骤"><a href="#操作步骤" class="headerlink" title="操作步骤"></a>操作步骤</h3><ul>
<li>配置 <code>project.cfg</code> 文件</li>
<li>执行 <code>main.bat</code></li>
</ul>
<h3 id="文件源码"><a href="#文件源码" class="headerlink" title="文件源码"></a>文件源码</h3><p><strong>project.cfg</strong></p>
<pre><code>compiler:2008
pri_name:SampleProject
prj_dir:../SampleProject
</code></pre><p><strong>vsvars.bat</strong></p>
<pre><code>@ECHO off

SET /a retval=0

GOTO CASE_%1
:CASE_2005
    IF NOT &quot;%VS80COMNTOOLS%&quot;==&quot;&quot; (
        CALL &quot;%VS80COMNTOOLS%&quot;vsvars32.bat
        SET /a retval=1
    )
    GOTO END_SWITCH
:CASE_2008
    IF NOT &quot;%VS90COMNTOOLS%&quot;==&quot;&quot; (
        CALL &quot;%VS90COMNTOOLS%&quot;vsvars32.bat
        SET /a retval=1
    )
    GOTO END_SWITCH
:CASE_2010
    IF NOT &quot;%VS100COMNTOOLS%&quot;==&quot;&quot; (
        CALL &quot;%VS100COMNTOOLS%&quot;vsvars32.bat
        SET /a retval=1
    )
    GOTO END_SWITCH
:END_SWITCH

EXIT /B %retval%
</code></pre><p><strong>main.bat</strong></p>
<pre><code>:: Function: Build/Clean Visual Studio Project
:: Author:   Dennis
:: Date:     2012-09-18

@ECHO off&amp;setlocal enabledelayedexpansion 

mode con lines=30 cols=100
title Build/Clean Visual Studio project

REM +++++++++++++++++++++++++++++++++
REM Get project name from config file
REM +++++++++++++++++++++++++++++++++
SET prj_name=
SET compiler=
SET prj_dir=

FOR /f &quot;tokens=1* delims=:&quot; %%a IN (project.cfg) DO (
    IF &quot;%%a&quot;==&quot;compiler&quot; SET compiler=%%b
    IF &quot;%%a&quot;==&quot;pri_name&quot; SET prj_name=%%b
    IF &quot;%%a&quot;==&quot;prj_dir&quot; SET prj_dir=%%b
)

IF &quot;%compiler%&quot;==&quot;&quot; (
    ECHO &quot;Config project compiler first.&quot;
    GOTO End
)

IF &quot;%prj_name%&quot;==&quot;&quot; (
    ECHO &quot;Config project name first.&quot;
    GOTO End
)

IF &quot;%prj_dir%&quot;==&quot;&quot; (
    ECHO &quot;Config project diretory first.&quot;
    GOTO End
)

REM +++++++++++++++++++++++++++++++++
REM Set compile environment
REM +++++++++++++++++++++++++++++++++
:Vars
CALL vsvars.bat %compiler%
IF %ERRORLEVEL% LEQ 0 (
    ECHO &quot;Error code: %ERRORLEVEL%&quot;
    ECHO &quot;Failed to SET VS %compiler% complile enviroment.&quot;
    ECHO &quot;Please check and try again.&quot;
    GOTO End
)

REM +++++++++++++++++++++++++++++++++
REM Main process
REM +++++++++++++++++++++++++++++++++
:Main
CLS
ECHO.
ECHO. %prj_name% project manager
ECHO.
ECHO. Porject type:
ECHO.     1.Release
ECHO.     2.Debug
ECHO.
ECHO. Opereate type:
ECHO.     1.Build
ECHO.     2.Clean
ECHO. __________________________________________________
ECHO.

SET choice=
SET /p choice= Please select project type(EXIT IF enter)：
IF &quot;%choice%&quot;==&quot;1&quot; ( SET prj_type=&quot;Release&quot; &amp; GOTO Next_Choise )
IF &quot;%choice%&quot;==&quot;2&quot; ( SET prj_type=&quot;Debug&quot; &amp; GOTO Next_Choise )
IF DEFINED choice GOTO Main
EXIT

:Next_Choise
ECHO Your selected is %prj_type%
SET /p choice= Please select operate type(EXIT IF enter)：
IF &quot;%choice%&quot;==&quot;1&quot; GOTO Case_Operate_%choice%
IF &quot;%choice%&quot;==&quot;2&quot; GOTO Case_Operate_%choice%
IF DEFINED choice GOTO Main
EXIT

:Case_Operate_1
    devenv.com %prj_dir%\%prj_name%.vcproj /build %prj_type%
    GOTO End_Switch
:Case_Operate_2
    devenv.com %prj_dir%\%prj_name%.vcproj /clean %prj_type%
    GOTO End_Switch
:End_Switch
    PAUSE
    GOTO Main


:End
PAUSE
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/09/19/MSVS-auto-compile/" data-id="ciqqpe1e6000inmpvvwh58t38" class="article-share-link">Partager</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-notepad++-support-markdown-syntax-highlight" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/09/17/notepad++-support-markdown-syntax-highlight/" class="article-date">
  <time datetime="2012-09-16T16:00:00.000Z" itemprop="datePublished">2012-09-17</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/09/17/notepad++-support-markdown-syntax-highlight/">Notepad++ support highlight of markdown</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>Notepad++默认不支持Markdown格式文件<code>md</code>高亮显示.</p>
<p>Github上的thomsmits童鞋填补了该空缺<br><a href="https://github.com/thomsmits/markdown_npp" target="_blank" rel="external">https://github.com/thomsmits/markdown_npp</a></p>
<p>这里也贴一下步骤:</p>
<ul>
<li>浏览器打开<a href="https://github.com/thomsmits/markdown_npp/blob/master/userDefineLang.xml" target="_blank" rel="external">userDefineLang.xml</a></li>
<li>复制全部代码,即从<code>&lt;NotepadPlus&gt;</code>到<code>&lt;/NotepadPlus&gt;</code>, 粘贴并保存为文件<code>userDefineLang.xml</code></li>
<li>打开Notepad++设置目录, <code>开始</code> &gt; <code>运行</code>, 输入 (或粘贴)<code>%APPDATA%\Notepad++</code>, 点击<code>确定</code></li>
<li>复制刚才保存的<code>userDefineLang.xml</code>到Notepad++设置目录</li>
<li>重启Notepad++</li>
</ul>
<p>就可以在Noepad++的菜单项<code>语言</code>下找到<code>Markdown</code></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/09/17/notepad++-support-markdown-syntax-highlight/" data-id="ciqqpe1e2000fnmpv3j430da6" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/write/">write</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-VC++-Use-CSharp-Dll" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/09/16/VC++-Use-CSharp-Dll/" class="article-date">
  <time datetime="2012-09-15T16:00:00.000Z" itemprop="datePublished">2012-09-16</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/09/16/VC++-Use-CSharp-Dll/">Dll write by C# use on VC++</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>##C#工程</p>
<ol>
<li><strong>修改项目属性</strong>  <blockquote>
<p><em>属性</em> -&gt; <em>应用程序</em> -&gt; <em>输出类型</em> -&gt; <em>类库</em>  </p>
</blockquote>
</li>
<li><strong>编译工程,生成类库文件</strong>  <blockquote>
<p><em>projectName.dll</em></p>
</blockquote>
</li>
</ol>
<p>##VC++工程</p>
<ol>
<li><strong>修改项目属性</strong>  <blockquote>
<p><em>配置属性</em> -&gt; <em>常规</em> -&gt; <em>项目默认值</em> -&gt; <em>公共语言运行时支持</em> -&gt; <em>公共语言运行时支持(/clr)</em>  </p>
</blockquote>
</li>
<li><strong>加入代码</strong>  </li>
</ol>
<ul>
<li><em>类库路径</em>  <code>#using &quot;./bin/CSharp.dll&quot;</code></li>
<li><em>设定使用的命名空间</em>  <code>using namespace CSharpNamespaceSample;</code></li>
<li><em>使用类成员和方法</em>  </li>
</ul>
<p><em>方法一:</em></p>
<pre><code>void TestFunc()
{
    CSharpClassSample ^cs = gcnew CSharpClassSample();

    cs-&gt;member_sample = 1;
    cs-&gt;func_sample();
}
</code></pre><p><em>方法二:</em></p>
<pre><code>ref class A{
public:
    static CSharpClassSample obj;
};

void TestFunc_1(void)
{
    A::obj.member_sample = 1;
}

void TestFunc_2(void)
{
    A::obj.func_sample();
}
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/09/16/VC++-Use-CSharp-Dll/" data-id="ciqqpe1dw000bnmpvs3m3trg3" class="article-share-link">Partager</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-winio-sample" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/09/16/winio-sample/" class="article-date">
  <time datetime="2012-09-15T16:00:00.000Z" itemprop="datePublished">2012-09-16</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/windows/">windows</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/09/16/winio-sample/">WinIO Sample</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <pre><code>// winio_sample.cpp

#include &lt;stdio.h&gt;
#include &lt;tchar.h&gt;

#include &lt;windows.h&gt;

typedef bool (*InitializeWinIo)();
typedef void (*ShutdownWinIo)();
typedef bool (*GetPortVal)(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize);
typedef bool (*SetPortVal)(WORD wPortAddr, DWORD dwPortVal, BYTE bSize);
typedef bool (*InstallWinIoDriver)(PWSTR pszWinIoDriverPath, bool IsDemandLoaded);

InitializeWinIo        pInitializeWinIo    = NULL;
ShutdownWinIo        pShutdownWinIo        = NULL;
GetPortVal            pGetPortVal            = NULL;
SetPortVal            pSetPortVal            = NULL;
InstallWinIoDriver    pInstallWinIoDriver = NULL;

HINSTANCE hinstLib = NULL;

VOID SafeGetNativeSystemInfo(__out LPSYSTEM_INFO lpSystemInfo)
{
    if (NULL==lpSystemInfo)    return;
    typedef VOID (WINAPI *LPFN_GetNativeSystemInfo)(LPSYSTEM_INFO lpSystemInfo);
    LPFN_GetNativeSystemInfo fnGetNativeSystemInfo = 
        (LPFN_GetNativeSystemInfo)GetProcAddress( GetModuleHandle(_T(&quot;kernel32&quot;)), &quot;GetNativeSystemInfo&quot;);
    if (NULL != fnGetNativeSystemInfo)
    {
        fnGetNativeSystemInfo(lpSystemInfo);
    }
    else
    {
        GetSystemInfo(lpSystemInfo);
    }
}

int GetSystemBits()
{
    SYSTEM_INFO si;
    SafeGetNativeSystemInfo(&amp;si);
    if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ||
        si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 )
    {
        return 64;
    }
    return 32;
}

int LoadLib()
{
    TCHAR *tcLib = NULL;
    tcLib = (32 == GetSystemBits()) ? TEXT(&quot;WinIo32.dll&quot;) : TEXT(&quot;WinIo64.dll&quot;);
    hinstLib = LoadLibrary(tcLib); 
    if (!hinstLib) 
    {
        wprintf(TEXT(&quot;Failed to load %s\n&quot;), tcLib);
        return 1;
    }
    return 0;
}

void FreeLib()
{
    if (hinstLib)
    {
        FreeLibrary(hinstLib);
        hinstLib = NULL;
    }
}

int GetFuncAddr()
{
    if (hinstLib != NULL) 
    { 
        pInitializeWinIo = (InitializeWinIo) GetProcAddress(hinstLib, &quot;InitializeWinIo&quot;);
        if (!pInitializeWinIo) return 1;

        pShutdownWinIo = (ShutdownWinIo) GetProcAddress(hinstLib, &quot;ShutdownWinIo&quot;);
        if (!pShutdownWinIo) return 1;

        pGetPortVal = (GetPortVal) GetProcAddress(hinstLib, &quot;GetPortVal&quot;);
        if (!pGetPortVal) return 1;

        pSetPortVal = (SetPortVal) GetProcAddress(hinstLib, &quot;SetPortVal&quot;);
        if (!pSetPortVal) return 1;

        pInstallWinIoDriver = (InstallWinIoDriver) GetProcAddress(hinstLib, &quot;InstallWinIoDriver&quot;);
        if (!pInstallWinIoDriver) return 1;
    }

    return 0;
}

void MyGetPortVal(WORD wPortAddr, BYTE bSize)
{
    DWORD dwPortVal = 0;
    pGetPortVal(wPortAddr, &amp;dwPortVal, bSize);
    char tmp = (char)dwPortVal;
    printf(&quot;port:0x%x, value:0x%x value:0x%x \n&quot;, wPortAddr, dwPortVal, tmp);
}

int GetPortValLoop()
{
    char *pBuf = NULL;
    char line[255] = {0};
    DWORD dwPortVal = 0;
    WORD wPortAddr = 0;
    BYTE bSize = 1;
    char bytePortVal = 0;

    printf(&quot;Enter get port value loop.\nType q can to quit application.\n&quot;);

    while(1)
    {
        printf(&quot;Please enter port address :&quot;);
        memset(line, 0, sizeof(line));
        pBuf = fgets(line, sizeof(line), stdin);

        // Type q and Enter to end loop
        if (!strcmp(pBuf,&quot;q\n&quot;)) break;

        wPortAddr = atoi(pBuf);

        pGetPortVal(wPortAddr, &amp;dwPortVal, bSize);

        bytePortVal = (char)dwPortVal;
        printf(&quot;port:0x%x, value:0x%x value:0x%x \n&quot;, wPortAddr, dwPortVal, bytePortVal);
    }

    getchar();
    return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
    if (0 != LoadLib())
    {
        goto ExitApp;
    }

    if(0 != GetFuncAddr())
    {
        printf(&quot;Failed to get function address.\n&quot;);
        goto ExitApp;
    }

    if (!pInitializeWinIo())
    {
        printf(&quot;Failed to initialize winio.\n&quot;);
        goto ExitApp;
    }

    Sleep(1000);

    printf(&quot;start to get port value.\n&quot;);
    printf(&quot;press any key to continue.\n&quot;);
    getchar();

    GetPortValLoop();

    printf(&quot;Shutdown WinIo.\n&quot;);
    printf(&quot;press any key to continue.\n&quot;);
    getchar();
    pShutdownWinIo();

ExitApp:
    FreeLib();
    printf(&quot;Press any key to continue.\n&quot;);
    getchar();
    return 0;
}
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/09/16/winio-sample/" data-id="ciqqpe1dz000dnmpvwngjb10h" class="article-share-link">Partager</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-write-blog-on-github" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2012/09/09/write-blog-on-github/" class="article-date">
  <time datetime="2012-09-08T16:00:00.000Z" itemprop="datePublished">2012-09-09</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/blog/">blog</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2012/09/09/write-blog-on-github/">write blog on github</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="2012年9月9日-在github创建blog日志"><a href="#2012年9月9日-在github创建blog日志" class="headerlink" title="2012年9月9日,在github创建blog日志"></a>2012年9月9日,在github创建blog日志</h3><ul>
<li><p>下载模版上传</p>
<ol>
<li>git clone <a href="https://github.com/plusjade/jekyll-bootstrap.git" target="_blank" rel="external">https://github.com/plusjade/jekyll-bootstrap.git</a> matrix207.github.com</li>
<li>cd matrix207.github.com/</li>
<li>git remote set-url origin git@github.com:matrix207/matrix207.github.com.git</li>
<li>git push origin master</li>
<li>ssh-keygen -t rsa -C “dennis.cpp@gmail.com”<br>作用: 产生ssh-key,上传代码需要</li>
<li>cat ~/.ssh/id_rsa.pub</li>
<li>git push origin master</li>
</ol>
</li>
<li><p>安装jekyll(Ubuntu)(本地预览)</p>
<ol>
<li>sudo apt-get install ruby  </li>
<li>sudo apt-get install rubygems1.8 rake  </li>
<li>sudo apt-get install ruby1.8-dev<br> 如果你在gem的安装过程中遇到了问题，你可能需要安装用于在Ruby 1.8上编译扩展模块的头文件。<br> 参考<a href="http://www.soimort.org/tech-blog/2011/11/19/introduction-to-jekyll_zh.html" target="_blank" rel="external">http://www.soimort.org/tech-blog/2011/11/19/introduction-to-jekyll_zh.html</a>  </li>
<li>sudo gem install jekyll  </li>
<li>sudo vim /etc/profile<br>  追加如下内容:<br> PATH=$PATH:/var/lib/gems/1.8/bin<br> export PATH  </li>
<li>source /etc/profile  </li>
<li>cd 项目目录<br>  如: cd /home/dennis/project/matrix207.github.com  </li>
<li>jekyll –server  </li>
</ol>
</li>
<li><p>Reference:  </p>
<ul>
<li><a href="http://zyzhang.github.com/blog/2012/08/29/%E5%83%8F%E6%9E%81%E5%AE%A2%E4%B8%80%E6%A0%B7%E5%86%99%E5%8D%9A%E5%AE%A2/" target="_blank" rel="external">像极客一样写博客</a></li>
<li><a href="https://github.com/zyzhang/zyzhang.github.com" target="_blank" rel="external">博客源码</a></li>
<li><a href="http://www.worldhello.net/2011/11/29/jekyll-based-blog-setup.html" target="_blank" rel="external">用git维护博客,酷.</a></li>
<li><a href="http://www.cnblogs.com/Lvkun/archive/2012/02/08/write-blog-on-github.html" target="_blank" rel="external">在github上写博客</a></li>
<li><a href="http://blog.csdn.net/keyboardota/article/details/7603630" target="_blank" rel="external">为github帐号添加SSH keys</a></li>
<li><a href="http://blog.csdn.net/liumengxinfly/article/details/7419144" target="_blank" rel="external">ubuntu 搭建 Jekyll环境</a></li>
<li><a href="http://www.soimort.org/tech-blog/2011/11/19/introduction-to-jekyll_zh.html" target="_blank" rel="external">像黑客一样写博客——Jekyll入门</a></li>
<li><a href="http://jekyllbootstrap.com/usage/jekyll-quick-start.html" target="_blank" rel="external">Jekyll Quick Start </a></li>
<li><a href="https://github.com/mojombo/jekyll/wiki/sites" target="_blank" rel="external">基于github的jekyll模板开发的网站/博客</a></li>
</ul>
</li>
<li><p>基本操纵:  </p>
<p>  产生新的文章<br>  rake post title=”MyNewPage”<br>  rake page name=”MyNewPage”<br>  rake preview  </p>
<p>  更新:<br>  git push origin master<br>  git add .<br>  git commit -m ‘create my site’<br>  git push</p>
<p>  例子:<br>  [root@localhost matrix207.github.com]# rake post title=”MyFisrtArticle”<br>  (in /home/dennis/project/matrix207.github.com.tmp)<br>  Creating new post: ./_posts/2012-09-14-myfisrtarticle.md<br>  [root@localhost matrix207.github.com]#  rake page name=”MyFisrtArticle”<br>  (in /home/dennis/project/matrix207.github.com.tmp)<br>  mkdir -p ./MyFisrtArticle<br>  Creating new page: ./MyFisrtArticle/index.html</p>
<p>  // git 删除文件,目录<br>  git rm abc.md<br>  git rm -r myfolder</p>
</li>
</ul>
<h3 id="2012年9月14日"><a href="#2012年9月14日" class="headerlink" title="2012年9月14日"></a>2012年9月14日</h3><ul>
<li><a href="http://equation85.github.com/blog/blog-with-github-and-jekyll/" target="_blank" rel="external">Github+Jekyll构建个人博客</a></li>
<li><a href="http://hjkl.me/git/2012/05/29/git-jekyll-blogging.html" target="_blank" rel="external">使用github+jekyll写博客</a></li>
<li><a href="http://www.pizn.me/2012/02/23/use-category-plugin-for-jekyll-blog.html" target="_blank" rel="external">为 Jekyll 博客添加 category 分类</a></li>
<li><a href="http://www.brucebot.com/2012/03/blog_with_jekyll_and_markdown/" target="_blank" rel="external">使用jekyll写博客</a></li>
<li><a href="http://www.ibm.com/developerworks/cn/linux/l-git/" target="_blank" rel="external">使用 Git 管理源代码</a></li>
</ul>
<h3 id="2012年9月16日"><a href="#2012年9月16日" class="headerlink" title="2012年9月16日"></a>2012年9月16日</h3><ul>
<li><a href="http://zh.wikipedia.org/wiki/Markdown" target="_blank" rel="external">Markdown 语法等介绍</a>  </li>
<li><a href="http://wowubuntu.com/markdown/" target="_blank" rel="external">Markdown 语法说明  </a><br>Markdown中的转义字符为<code>\</code></li>
</ul>
<h3 id="2012年9月24日"><a href="#2012年9月24日" class="headerlink" title="2012年9月24日"></a>2012年9月24日</h3><pre><code>配置git环境 用户名和邮件(配置文件目录~/.gitconfig)
git config --global user.name &quot;Your Name&quot;
git config --global user.email you@example.com
如:
  dennis@dennis-VirtualBox:~git config --global user.name &quot;Dennis&quot;
  dennis@dennis-VirtualBox:~git config --global user.emal &quot;dennis.cpp@gmail.com&quot;
确认配置是否成功:
git config user.name
git config user.email
也可以直接编辑文件:
$ cat ~/.gitconfig
</code></pre><h3 id="2012年12月14日"><a href="#2012年12月14日" class="headerlink" title="2012年12月14日"></a>2012年12月14日</h3><pre><code>环境windows xp，git
git status 查看状态
git pull 更新
在_post目录中加入新的文章后如:2012-12-14-visual-studio-project-clean.md 
执行下面的命令更新上传
git push origin master
下面这三行是执行上一个命令要求输入用户名和密码
    Username for &apos;github.com&apos;:
    Password for &apos;github.com&apos;:
    Everything up-to-date
git add .
git commit -m &quot;create my site&quot;
git push
</code></pre><h3 id="2013年01月04日"><a href="#2013年01月04日" class="headerlink" title="2013年01月04日"></a>2013年01月04日</h3><pre><code>Fedora17安装Jekyll预览github博客文章
1.安装工具
    yum install ruby-devel
    gem install jekyll
2.在blog目录下运行jekyll服务
    jekyll --server
3.预览blog
    打开http://localhost:4000
4.rake产生post文章
    gem install rake
    rake post title=&quot;***&quot;
</code></pre><h3 id="2013年01月25日"><a href="#2013年01月25日" class="headerlink" title="2013年01月25日"></a>2013年01月25日</h3><ul>
<li><a href="http://www.worldhello.net/gotgithub/appendix/markups.html" target="_blank" rel="external">轻量级标记语言</a></li>
</ul>
<h3 id="2013年01月26日"><a href="#2013年01月26日" class="headerlink" title="2013年01月26日"></a>2013年01月26日</h3><ul>
<li><a href="http://kyle.xlau.org/posts/blogging-like-a-hacker.html" target="_blank" rel="external">像黑客一样写博客</a></li>
<li><a href="http://tom.preston-werner.com/2008/11/17/blogging-like-a-hacker.html" target="_blank" rel="external">Blogging Like a Hacker</a></li>
<li><a href="https://github.com/mojombo/jekyll/wiki/Sites" target="_blank" rel="external">Blog Site use Jekyll</a></li>
<li><a href="http://techtinkering.com/" target="_blank" rel="external">TechTinkering</a>(<a href="https://github.com/lawrencewoodman/techtinkering.com" target="_blank" rel="external">source</a>)</li>
</ul>
<h3 id="2014年05月23日"><a href="#2014年05月23日" class="headerlink" title="2014年05月23日"></a>2014年05月23日</h3><ul>
<li><a href="http://erjjones.github.io/blog/How-I-built-my-blog-in-one-day/" target="_blank" rel="external">How I built my blog in one day</a></li>
<li><a href="http://erjjones.github.io/blog/Part-two-how-I-built-my-blog/" target="_blank" rel="external">Part two on how I built my blog</a></li>
<li><a href="https://pages.github.com/" target="_blank" rel="external">Github pages</a></li>
<li><a href="http://jekyllbootstrap.com/usage/jekyll-quick-start.html" target="_blank" rel="external">jekll quick start</a></li>
</ul>
<h3 id="2014年06月05日"><a href="#2014年06月05日" class="headerlink" title="2014年06月05日"></a>2014年06月05日</h3><ul>
<li><a href="http://pchou.info/web-build/2013/01/09/build-github-blog-page-06.html" target="_blank" rel="external">一步步在GitHub上创建博客主页:评论功能,站点统计</a></li>
<li><a href="http://beyondvincent.com/blog/2013/07/27/107-hello-page-of-github/" target="_blank" rel="external">你好！github页面: 域名解析</a></li>
</ul>
<h3 id="2014年06月21日"><a href="#2014年06月21日" class="headerlink" title="2014年06月21日"></a>2014年06月21日</h3><ul>
<li><p><a href="http://askubuntu.com/questions/91693/how-do-you-uninstall-ruby-1-8-7-and-install-ruby-1-9-2" target="_blank" rel="external">How do you uninstall Ruby 1.8.7 and install Ruby 1.9.2?</a></p>
</li>
<li><p><strong>Install jekyll on Ubuntu</strong>  </p>
<pre><code>dennis@dennis:~/work/git/matrix207.github.com$ sudo gem install jekyll
ERROR:  Error installing jekyll:
    celluloid requires Ruby version &gt;= 1.9.2.
dennis@dennis:~/work/git/matrix207.github.com$ ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
dennis@dennis:~/work/git/matrix207.github.com$ sudo apt-get install ruby1.9.3
Reading package lists... Done
Building dependency tree       
......
dennis@dennis:~/work/git/matrix207.github.com$ sudo update-alternatives --config ruby
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/ruby1.8     50        auto mode
  1            /usr/bin/ruby1.8     50        manual mode
  2            /usr/bin/ruby1.9.1   10        manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
dennis@dennis:~/work/git/matrix207.github.com$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
dennis@dennis:~/work/git/matrix207.github.com$ sudo update-alternatives --config gem
There are 2 choices for the alternative gem (providing /usr/bin/gem).

  Selection    Path               Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gem1.8     180       auto mode
  1            /usr/bin/gem1.8     180       manual mode
  2            /usr/bin/gem1.9.1   10        manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/gem1.9.1 to provide /usr/bin/gem (gem) in manual mode.
dennis@dennis:~/work/git/matrix207.github.com$ gem -v
1.8.11
</code></pre></li>
<li><p>install nodejs for JavaScript runtime environment<br><code>sudo apt-get install nodejs</code></p>
</li>
<li><p><code>jekyll --server</code> change to <code>jekyll server</code></p>
</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2012/09/09/write-blog-on-github/" data-id="ciqqpe1ds0009nmpvcwtvuzkn" class="article-share-link">Partager</a>
      
      
    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    <a class="extend prev" rel="prev" href="/page/17/">&laquo; __('prev')</a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/16/">16</a><a class="page-number" href="/page/17/">17</a><span class="page-number current">18</span>
  </nav>
</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Catégories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/blog/">blog</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/english/">english</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/">kernel</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/language/">language</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/math/">math</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/network/">network</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/others/">others</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/person/">person</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/program/">program</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/source/">source</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/storage/">storage</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/tools/">tools</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/windows/">windows</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Mot-clés</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/FAQ/">FAQ</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IRC/">IRC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Translation/">Translation</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/api/">api</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/assembly/">assembly</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/awk/">awk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/batch/">batch</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/blog/">blog</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/book/">book</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c++</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/crash/">crash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/debug/">debug</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dot/">dot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/driver/">driver</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/emacs/">emacs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exploit/">exploit</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/file-system/">file system</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/filesystem/">filesystem</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flowchart/">flowchart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gcc/">gcc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/google/">google</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/graphviz/">graphviz</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hosts/">hosts</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iscsi/">iscsi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/job/">job</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/json/">json</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kernel/">kernel</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lisp/">lisp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lua/">lua</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/makefile/">makefile</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/malloc/">malloc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/math/">math</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/maxima/">maxima</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory/">memory</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory-overflow/">memory overflow</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mtrace/">mtrace</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netdisk/">netdisk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/network/">network</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/others/">others</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pandoc/">pandoc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/performance/">performance</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/person/">person</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/">python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rsync/">rsync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sed/">sed</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/shell/">shell</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/skype/">skype</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sms/">sms</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/source/">source</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ssh/">ssh</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/stack/">stack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/storage/">storage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/study/">study</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/svn/">svn</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sync/">sync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/time/">time</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tools/">tools</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/valgrind/">valgrind</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vi/">vi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/virtual/">virtual</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wget/">wget</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/">windows</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wireshark/">wireshark</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/write/">write</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xml/">xml</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Nuage de mot-clés</h3>
    <div class="widget tagcloud">
      <a href="/tags/FAQ/" style="font-size: 10px;">FAQ</a> <a href="/tags/IRC/" style="font-size: 10px;">IRC</a> <a href="/tags/Translation/" style="font-size: 13px;">Translation</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/api/" style="font-size: 10px;">api</a> <a href="/tags/assembly/" style="font-size: 10px;">assembly</a> <a href="/tags/awk/" style="font-size: 11px;">awk</a> <a href="/tags/batch/" style="font-size: 14px;">batch</a> <a href="/tags/blog/" style="font-size: 10px;">blog</a> <a href="/tags/book/" style="font-size: 10px;">book</a> <a href="/tags/c/" style="font-size: 16px;">c</a> <a href="/tags/c/" style="font-size: 19px;">c++</a> <a href="/tags/cache/" style="font-size: 10px;">cache</a> <a href="/tags/crash/" style="font-size: 10px;">crash</a> <a href="/tags/database/" style="font-size: 17px;">database</a> <a href="/tags/debug/" style="font-size: 12px;">debug</a> <a href="/tags/dot/" style="font-size: 10px;">dot</a> <a href="/tags/driver/" style="font-size: 10px;">driver</a> <a href="/tags/emacs/" style="font-size: 11px;">emacs</a> <a href="/tags/exploit/" style="font-size: 10px;">exploit</a> <a href="/tags/file-system/" style="font-size: 10px;">file system</a> <a href="/tags/filesystem/" style="font-size: 12px;">filesystem</a> <a href="/tags/flowchart/" style="font-size: 10px;">flowchart</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 12px;">git</a> <a href="/tags/google/" style="font-size: 11px;">google</a> <a href="/tags/graphviz/" style="font-size: 11px;">graphviz</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/hosts/" style="font-size: 10px;">hosts</a> <a href="/tags/iscsi/" style="font-size: 14px;">iscsi</a> <a href="/tags/java/" style="font-size: 10px;">java</a> <a href="/tags/javascript/" style="font-size: 10px;">javascript</a> <a href="/tags/job/" style="font-size: 10px;">job</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/kernel/" style="font-size: 14px;">kernel</a> <a href="/tags/linux/" style="font-size: 14px;">linux</a> <a href="/tags/lisp/" style="font-size: 10px;">lisp</a> <a href="/tags/lua/" style="font-size: 10px;">lua</a> <a href="/tags/makefile/" style="font-size: 10px;">makefile</a> <a href="/tags/malloc/" style="font-size: 10px;">malloc</a> <a href="/tags/math/" style="font-size: 11px;">math</a> <a href="/tags/maxima/" style="font-size: 10px;">maxima</a> <a href="/tags/memory/" style="font-size: 11px;">memory</a> <a href="/tags/memory-overflow/" style="font-size: 10px;">memory overflow</a> <a href="/tags/mtrace/" style="font-size: 10px;">mtrace</a> <a href="/tags/netdisk/" style="font-size: 10px;">netdisk</a> <a href="/tags/network/" style="font-size: 20px;">network</a> <a href="/tags/others/" style="font-size: 18px;">others</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a> <a href="/tags/performance/" style="font-size: 16px;">performance</a> <a href="/tags/person/" style="font-size: 11px;">person</a> <a href="/tags/protobuf/" style="font-size: 11px;">protobuf</a> <a href="/tags/python/" style="font-size: 10px;">python</a> <a href="/tags/rsync/" style="font-size: 10px;">rsync</a> <a href="/tags/sed/" style="font-size: 11px;">sed</a> <a href="/tags/shell/" style="font-size: 15px;">shell</a> <a href="/tags/skype/" style="font-size: 11px;">skype</a> <a href="/tags/sms/" style="font-size: 10px;">sms</a> <a href="/tags/source/" style="font-size: 11px;">source</a> <a href="/tags/ssh/" style="font-size: 10px;">ssh</a> <a href="/tags/stack/" style="font-size: 10px;">stack</a> <a href="/tags/storage/" style="font-size: 15px;">storage</a> <a href="/tags/study/" style="font-size: 10px;">study</a> <a href="/tags/svn/" style="font-size: 11px;">svn</a> <a href="/tags/sync/" style="font-size: 10px;">sync</a> <a href="/tags/test/" style="font-size: 11px;">test</a> <a href="/tags/time/" style="font-size: 10px;">time</a> <a href="/tags/tools/" style="font-size: 16px;">tools</a> <a href="/tags/valgrind/" style="font-size: 10px;">valgrind</a> <a href="/tags/vi/" style="font-size: 10px;">vi</a> <a href="/tags/vim/" style="font-size: 14px;">vim</a> <a href="/tags/virtual/" style="font-size: 11px;">virtual</a> <a href="/tags/wget/" style="font-size: 10px;">wget</a> <a href="/tags/windows/" style="font-size: 11px;">windows</a> <a href="/tags/wireshark/" style="font-size: 10px;">wireshark</a> <a href="/tags/write/" style="font-size: 13px;">write</a> <a href="/tags/xml/" style="font-size: 10px;">xml</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/07/">July 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">June 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">January 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/09/">September 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/08/">August 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">July 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">June 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/09/">September 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/04/">April 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/03/">March 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/02/">February 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/01/">January 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/12/">December 2012</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/09/">September 2012</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Articles récents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/07/17/how-to-implement-malloc/">如何实现一个malloc</a>
          </li>
        
          <li>
            <a href="/2016/07/17/study-grep-more/">grep工作原理</a>
          </li>
        
          <li>
            <a href="/2016/07/17/2016-04-13-malloc/">malloc</a>
          </li>
        
          <li>
            <a href="/2016/04/27/include-what-you-use/">使用IWYU整理头文件引用</a>
          </li>
        
          <li>
            <a href="/2016/04/24/understand-gcc-assembly-output/">understand gcc assembly output</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 Matrix207<br>
      Propulsé by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>